package inabit.inabitcompiler.productions.rule.expressions;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.inabitcompiler.lexical.InabitTokenClass;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**Rest -> is id*/
/**@author Rafael Rocha*/
public class RestRule2 extends Production{

	private Terminal is, id;
	
	public RestRule2() {
		super("Rest");
	}

	@Override
	protected Symbol[] production(final NonTerminal nonTerminal) {
		is = new Terminal(InabitTokenClass.IS);
		id = new Terminal(InabitTokenClass.ID);
		Symbol[] symbols = {
				is, id,
				new InabitSemanticAction(nonTerminal) {
					
					@Override
					public void execute() throws Exception {
						nonTerminal.code = "is" + ":" + id.getValue(); 
					}
				}
		};
		return symbols;
	}

}
